﻿using FreeSql.DataAnnotations;
using MySqlX.XDevAPI.Common;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using ZhonTai.Admin.Core.Entities;
using ZhonTai.Industry.Domain.WorkStation;

namespace ZhonTai.Industry.Domain.AlarmRecord
{
    /// <summary>
    /// 报警记录
    /// </summary>
    /// <remarks>数据块偏移量</remarks>
    [Table(Name = "prd_alarm_record_{yyyyMM}", AsTable = "CreatedTime=2025-6-1(1 month)")]
    [Index("idx_station_created", nameof(StationId) + "," + nameof(CreatedTime))]
    public class AlarmRecordEntity : EntityBase
    {
        /// <summary>
        /// 工站Id
        /// </summary>
        public long StationId { get; set; }

        /// <summary>
        /// 报警代号
        /// </summary>
        public string? AlarmCode { get; set; }

        /// <summary>
        /// 开始时间
        /// </summary>
        public DateTime StartTime { get; set; }

        /// <summary>
        /// 结束时间
        /// </summary>
        public DateTime EndTime { get; set; }

        /// <summary>
        /// 总计时间
        /// </summary>
        /// <remarks>循环时间</remarks>
        public double CycleTime { get; set; }

        /// <summary>
        /// 报警描述
        /// </summary>
        public string? Description { get; set; }

        /// <summary>
        /// 工站
        /// </summary>
        [Navigate(nameof(StationId))]
        public WorkStationEntity WorkStation { get; set; }
    }
}